package com.yonyou.pmclouds.task.mapper;

import com.yonyou.pmclouds.basecom.dao.BaseMapper;
import com.yonyou.pmclouds.basecom.entity.KeyCountVO;
import com.yonyou.pmclouds.task.entity.TaskVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

@Mapper
public interface TaskMapper extends BaseMapper<TaskVO> {

    List<TaskVO> queryTodoTaskList(String pk_receiver);

    List<TaskVO> queryOwnLaunchBills(@Param("taskcreator") String taskcreator,
                                     @Param("excludeTypes") String[] excludeTypes,
                                     @Param("start") int start,
                                     @Param("size") int size);

    TaskVO[] queryTaskByBillAndReceiver(@Param("pk_bill") String[] pk_bills,
                                        @Param("pk_receiver") String pk_receiver,
                                        @Param("task_status") String task_status);

    TaskVO[] queryTaskByPkBill(@Param("pk_bill") String pk_bill);

    TaskVO[] queryByPkTasks(@Param("pkTasks") List<String> pkTasks);

    List<TaskVO> getDoneTaskList(@Param("pkReceiver") String pkReceiver, @Param("start") int start, @Param("size") int size);

    List<TaskVO> getDoneTaskListExceptBIllStatus(@Param("pkReceiver") String pkReceiver, @Param("statuses") byte[] statuses, @Param("start") int start, @Param("size") int size);

    /**
     * 这个方法存在sql注入的风险
     */
    @Deprecated
    TaskVO[] queryByPreTask(@Param("pkPretasks") String pkPretasks);

    int countBillCountExcludeType(@Param("projects") String[] projects, @Param("billTypes") String[] billTypes,
                                  @Param("start") Date start, @Param("end") Date end);

    KeyCountVO[] countProjectBillCountExcludeType(@Param("projects") String[] projects, @Param("billTypes") String[] billTypes,
                                                  @Param("timeStart") Date timeStart, @Param("timeEnd") Date timeEnd,
                                                  @Param("start") int start, @Param("offset") int offset);

    TaskVO[] queryAllByPkBill(@Param("pk_bill") String pk_bill);

}
